<?php
require_once 'config.php';
require_once 'function.php';
require_once 'class/Mysql.class.php';

$db = new Mysql();
$data = $db->getAll( 'category', 'cat_web = 1 AND is_translate=0', 'cat_id', 'cat_id DESC' );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Feature翻译</title>
<link href="../wondershare/styles/main.css" rel="stylesheet" type="text/css" />
<link href="../wondershare/styles/general.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.6.2.js"></script>
<script type="text/javascript">
var i = 0;
var id_arr = new Array();
var is_tring = true;
$(function(){
	$('.key_id').each(function(){
		id_arr.push( parseInt($(this).html()) );
	})
})

function T(){
	if( ! is_tring || !id_arr[i] ) return;
	$("#ifra").attr('src','translate.php?type=category&kid='+id_arr[i]);	
}

function S(){
	is_tring = false;
}

function ok(){
	$("#state_"+i).html('<span style="color:green">翻译成功</span>');	
	i++;
	T();
}

function no(){
	$("#state_"+i).html('<span style="color:red">翻译失败</span>');	
	i++;
	T();
}

function reTr( s ){
	i = s;
	T();	
}
</script>
</head>

<body>
<input type="button" onclick="is_tring = true; T()" value=" 翻 译 " />
<input type="button" onclick="S()" value=" 停止翻译 " />
<iframe id="ifra" width="100%" height="150"></iframe>
<table cellpadding="2" cellspacing="1" id="list_table" width="100%" class="list-div">
  <tr>
    <th width="50">Feature ID</th>
    <th></th>
    <th width="100">状态</th>
    <th width="100">操作</th>
  </tr>
  <?php foreach($data as $k=>$v ){?>
  <tr>
    <td class="key_id" align="center"><?php echo $v['cat_id'];?></td>
    <td></td>
    <td id="state_<?php echo $k;?>" align="center"></td>
    <td align="center"><a href="javascript:reTr(<?php echo $k;?>);">从此开始翻译</a></td>
  </tr>
  <?php }?>
</table>
共<?php echo $k;?>篇
</body>
</html>
